package com.yunhui.entity;


import java.util.Date;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;

/**
 * <p>
 *评论的实体类
 * </p>
 *
 * @author WGH
 * @since 2019-12-15
 */
public class Comment extends Model<Comment> implements Serializable{

    private static final long serialVersionUID = 1L;

    /**
     * 主键非空
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 评论用户编号
     */
    @TableField("uId")
    private Integer uId;
    /**
     * 发布行程的id
     */
    @TableField("oId")
    private Integer oId;
    /**
     * 评论内容
     */
    private String content;
    /**
     * 评论时间
     */

    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//set
    @TableField("createTime")
    private Date createTime;
    /**
     * 商家回复内容
     */
    private String reply;
    /**
     * 回复时间
     */
    @TableField("replyTime")
    private Date replyTime;


    /**
     *评分等级
     */
    @TableField("gradeLeven")
    private Integer gradeLeven;

    /**
     * 评分名称
     */
    @TableField(exist = false)
    private String  gradeLevenName;

    public Integer getGradeLeven() {
        return gradeLeven;
    }

    public void setGradeLeven(Integer gradeLeven) {
        this.gradeLeven = gradeLeven;
        this.setGradeLevenName();
    }

    public String getGradeLevenName() {
        return gradeLevenName;
    }

    /**
     * 根据评分等级判断给评分名称赋值
     */
    public void setGradeLevenName() {
       if(gradeLeven==1){
           this.gradeLevenName="好评";
       }else if( gradeLeven==2){
           this.gradeLevenName="中评";
       }else{
           this.gradeLevenName="差评";
       }
    }

    /**
     * 用户名称
     */
    @TableField(exist = false)
    private String userName;

    /**
     * 行程名称
     */
    @TableField(exist = false)
    private String rName;


    @TableField(exist = false)
    private String imgName1;

    public String getImgName1() {
        return imgName1;
    }

    public void setImgName1(String imgName1) {
        this.imgName1 = imgName1;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getrName() {
        return rName;
    }

    public void setrName(String rName) {
        this.rName = rName;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Integer getuId() {
        return uId;
    }

    public void setuId(Integer uId) {
        this.uId = uId;
    }

    public Integer getOId() {
        return oId;
    }

    public void setOId(Integer oId) {
        this.oId = oId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getReply() {
        return reply;
    }

    public void setReply(String reply) {
        this.reply = reply;
    }

    public Date getReplyTime() {
        return replyTime;
    }

    public void setReplyTime(Date replyTime) {
        this.replyTime = replyTime;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }

    @Override
    public String toString() {
        return "Comment{" +
        ", id=" + id +
        ", uId=" + uId +
        ", rId=" + oId +
        ", content=" + content +
        ", createTime=" + createTime +
        ", reply=" + reply +
        ", replyTime=" + replyTime +
        "}";
    }
}
